import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
//class FlyFootBmp
    
    export  class FlyFootBmp /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            mouseChildren = false;
            buttonMode = true;
            this._upSkin = GlobalClass.getBitmap("FlyBoot_upSkin");
            this._overSkin = GlobalClass.getBitmap("FlyBoot_overSkin");
            addChild(this._upSkin);
            this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddToStage);
            this.addEventListener(flash.events.Event.REMOVED_FROM_STAGE, this.onRemoveFromStage);
            return;
        }

        /* internal  */onAddToStage(arg1: Object /* flash.events.Event */): void
        {
            this.update();
            return;
        }

        /* internal  */onRemoveFromStage(arg1: Object /* flash.events.Event */): void
        {
            this.dispose();
            return;
        }

        /* internal  */onMouseOverHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            addEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseOutHandler);
            if (this.contains(this._upSkin)) 
            {
                this.removeChild(this._upSkin);
            }
            if (!this.contains(this._overSkin)) 
            {
                this.addChild(this._overSkin);
            }
            this._overSkin.y = 1;
            return;
        }

        /* internal  */onMouseOutHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            removeEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseOutHandler);
            if (this.contains(this._overSkin)) 
            {
                this.removeChild(this._overSkin);
            }
            if (!this.contains(this._upSkin)) 
            {
                this.addChild(this._upSkin);
            }
            this._overSkin.y = 0;
            return;
        }

        public update(): void
        {
            this.toolTipData = FlyFootBmp._toolTipTxt;
            addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onMouseOverHandler);
            return;
        }

        public dispose(): void
        {
            ToolTipsManager.unregister(this);
            removeEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onMouseOverHandler);
            return;
        }

        public get toolTipData()
        {
            return this._tooltipData;
        }

        public set toolTipData(arg1)
        {
            if (arg1 == null || arg1 == "") 
            {
                ToolTipsManager.unregister(this);
            }
            else 
            {
                ToolTipsManager.register(this);
            }
            this._tooltipData = arg1;
            return;
        }

        /* internal */ static /* const */_toolTipTxt: string=HTMLUtil.addColor(Language.getString(20630), "#ffffff");

        /* internal */ /* var */_upSkin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_overSkin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_tooltipData;
    }
